package com.fqgj.xjd.user.client.enums;

/**
 * @program: cashmama-user
 * @description
 * @author: frank
 * @create: 2020-05-25 11:38
 **/
public enum RewardTypeEnum {

    GET_REWARD(0, "GET_REWARD"),USED_REWARD(1, "USED_REWARD");

    private Integer code;
    private String name;

    RewardTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public RewardTypeEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getName() {
        return name;
    }

    public RewardTypeEnum setName(String name) {
        this.name = name;
        return this;
    }

    public static RewardTypeEnum getByCode(Integer code){
        if(code == null){
            return null;
        }
        for(RewardTypeEnum rewardTypeEnum : RewardTypeEnum.values()){
            if(rewardTypeEnum.getCode() == code){
                return rewardTypeEnum;
            }
        }
        return null;
    }
}
